using UnityEngine;

namespace Super
{
	public static class LogUtil
	{
		public static void Log(LogType logType, LogCategory logCategory, string info)
		{
			bool state = FWSetManager.GetSwitchState("ShowLog");
			if (!state) { return; }

			info = GetColorCategory(logCategory) + "\t" + info;
			switch (logType)
			{
				case LogType.Normal:
					Debug.Log(info);
					break;
				case LogType.Warn:
					Debug.LogWarning(info);
					break;
				case LogType.Error:
					Debug.LogError(info);
					break;
			}
		}

		public static string GetColorCategory(LogCategory logCategory)
		{
			int colorIndex = (int)logCategory;
			string colorHtml = ColorUtility.ToHtmlStringRGB(GlobalUtil.GetColor(colorIndex));
			string str = logCategory.ToString();
			return string.Format("<color=#{0}>{1}</color>", colorHtml, str);
		}
	}
}

